'use strict'

process.chdir(__dirname)

const {httpcli} = require('gohttp')

const cdpc = require('cdpc')

const config = require('../config/config')

let cm = new cdpc()

cm.runChilds([
  {
    name: 'ab',
    command: '..\\..\\Apache2.4.39\\bin\\ab.exe',
    args: [
      '-r', '-n', '6000', '-c', '150',  `http://localhost:${config.port}/public/test/caclt`
    ],
    options: {
      stdio: ['ignore', 1, 2]
    },
    restart: 'fail-count',
    restartLimit: 1,
    autoRemove: true,
    callback: (ch) => {
      ch.on('exit', (code) => {
        process.exit(code)
      })
    }
  }
])
